package comday06;

public class Demo06 {
    public static void main(String[] args) {
        int[] arr = {31,42,23,64,25,36};

        int count = getCount(arr);
        System.out.println(count);
    }

    //请定义方法getCount()，计算数组中：大于平均年龄的员工有多少人
    public static int getCount(int[] arr){
        //1.求和
        double sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }

        //2.求平均值
        double ping = sum/arr.length;
        System.out.println(ping);

        // 3.求个数
        int count=0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]>ping){
                count++;
            }
        }
        return count;


    }




}
